package liming.tool.handle.net.tu;

import liming.tool.handle.net.root.RootSocket;
import liming.tool.handle.net.tcp.socket.TcpClientSocket;
import liming.tool.handle.net.tcp.socket.TcpReceiveMap;

import java.io.IOException;
import java.net.InetAddress;

public abstract class TUClientSocket extends RootSocket {
    /**
     * 默认构造函数，在网络通信中，套接字信息都是一个必要的参数
     *
     * @param inetAddress
     * @param port
     */
    public TUClientSocket(InetAddress inetAddress, int port) throws IOException, ClassNotFoundException {
        super(inetAddress, port);
        TcpClientSocket tcpClientSocket = new TcpClientSocket(inetAddress, port) {
            @Override
            public boolean doWork(TcpReceiveMap respond) throws Exception {
                return doWorkTcp(respond);
            }

            @Override
            public TcpReceiveMap write(TcpReceiveMap tcpReceiveMap) throws Exception {
                return null;
            }

            @Override
            public TcpReceiveMap addReceiveMap(TcpReceiveMap tcpReceiveMap) throws Exception {
                return null;
            }
        };
    }

    public abstract boolean doWorkTcp(TcpReceiveMap respond);
}
